package com.daotingli.backendprograms.utils;



import java.util.HashMap;
import java.util.Map;

public class Result extends HashMap<String, Object> {

    public static Result success() {
        return new Result().put("code", 200).put("msg", "操作成功");
    }

    public static Result success(Object data) {
        return new Result()
                .put("code", 200)
                .put("msg", "操作成功")
                .put("data", data);

    }

    public static Result error() {
        return new Result().put("code", 500).put("msg", "操作失败");
    }


    public static Result error(String message) {
        return new Result().put("code", 500).put("msg", message);
    }

    public Result put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
